package org.odk.clinic.android.activities;


import org.odk.clinic.android.R;
import org.odk.clinic.android.database.SQLiteAdapter;

import android.app.ListActivity;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.SimpleCursorAdapter;

public class ViewObservationActivity extends ListActivity {
	private SQLiteAdapter mDB;
	private Cursor mCursor;
	protected void onCreate(Bundle ici){
		super.onCreate(ici);
		setContentView(R.layout.list_observation);
		///
		mDB = new SQLiteAdapter(this);
		mDB.open();
		
		int mid = DetailPatientActivity.mid;
		mCursor = mDB.getAllObservation(mid);
		if(mCursor.moveToFirst()){
			startManagingCursor(mCursor);
			String [] from = new String[]{SQLiteAdapter.KEY_CONCEPTNAME,SQLiteAdapter.KEY_DRUGS_NAME,SQLiteAdapter.KEY_QUANTITY,SQLiteAdapter.KEY_OBS_COMMENT};
			int [] to = new int[]{R.id.listobs_concept,R.id.listobs_drugs,R.id.listobs_quantity,R.id.listobs_comments};
			SimpleCursorAdapter adap = new SimpleCursorAdapter(this,R.layout.list_observation_item,mCursor,from,to);
			setListAdapter(adap);
			
		}
		
	}

}
